#ifndef EMPIRE_REP_H
#define EMPIRE_REP_H


class empire;
class empireLib;

//includes------------------------------
#include <string>
#include <stdlib.h>
#include "commands.h"
#include "../fleets/ship.h"
#include "../fleets/fleet.h"

//defines-------------------------------
enum tnOrder{
    trnFixed = 0,
    trnRandom,
    trnList
};

//prototypes----------------------------

//definitions---------------------------

class empire{
        public:
            //constructors
            empire(int playerNum, string name);
            ~empire();
            void designShiping();
            
            //accessors
            int gNum();
            string gName();

            //take turn loop
            bool hasPlayed();
            void prepareTurn();
            void beginTurn();
            void endTurn();
            void docommand(command* cmd);

            //lib access
            int gFleet(int x, int y); //get a fleet by coords
            int gFleet(int x, int y, int mx, int my); //get a fleet by a range of coords
            int gFleet(int id); //get a fleet by its id
            int gShip(int id); //get a ship by its id

            //base information
            int numShipTypes();
        protected:
        private:
            //empire information
            int playerNum;
            string empName;
            shipLib* shiping;
            fLib* fleets;

            //for use by turn ordering
            bool played;
            int turnNum;
};

class empireLib{
        public:
            //constructors
            static bool initialize(int playerNums);
            static empireLib* getEmpireLib();
            static empireLib* releaseEmpireLib();
            ~empireLib();

            //player order
            void orderPolicy(tnOrder pollicy);
            tnOrder orderPolicy();
            empire* nextPlayer();
            void endTurn();
            int activePlayer();

        protected:
            //hidden constructor
            empireLib(int numPlayers);

        private:
            static empireLib* single;

            //turn bookeeping vars
            int numPlayed;
            int currentTurn;

            //lib data
            bool inUse;
            int pNum;
            empire** players;     //1d array of pointers
            tnOrder orderPol;     //changest he turn order
};

#endif